#pragma once 


namespace MyList{

  template<class Iterator,class Ref,class Ptr>
  class ReverseIterator{
    public:
    
      ReverseIterator(const Iterator& it)
      :  _it(it)
      {}


      typedef ReverseIterator<Iterator,Ref,Ptr> self;  


      Ref operator*(){
        Iterator cur(_it);
        return *--cur;
      }

      Ptr operator->(){
        return &operator*();
      }

      self& operator++(){
        return --_it;
      }

      self& operator--(){
        return ++_it;
      }

      self operator++(int){
        Iterator cur(_it);
        --_it;
        return cur;
      }

      self operator--(int){
        Iterator cur(_it);
        ++_it;
        return cur;
      }

      bool operator==(const self& it)const {
        return it._it==_it;
      }

      bool operator!=(const self& it)const {
        return it._it!=_it;
      }

    private:
      Iterator _it;

  };

}
